package ktoaon.com.impl;

import ktoaon.com.BaseDao;
import ktoaon.com.KtDeptcom;
import ktoaon.pojo.KtDept;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * @author www
 * @Description: KtDeptcom实现类
 * @date 2020-05-30 20:39
 */

public class KtDeptcomimpl extends BaseDao implements KtDeptcom {
    //查询全部
    @Override
    public List<KtDept> sele() {
        String sql = "SELECT * FROM  kt_dept";
        ResultSet rs = null;
        List<KtDept> list = new ArrayList<KtDept>();
        try {
            rs = super.exceuteQuery(sql, null);
            while (rs.next()) {
                KtDept man = new KtDept();
                man.setDeptno(rs.getInt(1));
                man.setDname(rs.getString(2));
                man.setPid(rs.getInt(3));
                list.add(man);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
}
